﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OrderServiceReference;
using AccountServiceReference;
using System.ServiceModel;

public partial class UserControls_orderhistory : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        LoadData();
    }
    protected void GridView1_PageIndexChanged(object sender, EventArgs e)
    {
        LoadData();
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
    }
    
    private void LoadData()
    {
        try
        {
            var client = new OrderServiceClient();
            var customerid = new AccountServiceClient().GetAccountId(Session["User"].ToString());
            GridView1.DataSource = client.GetOrderDetailsOfCustomer(customerid);
            GridView1.DataBind();
        }
        catch (FaultException<Order> faultException)
        {
            
        }
        catch (Exception)
        {
        }
        
    }
}